<template>
	<view>
		<view v-if="isLoading" style="width: 100%;height: calc(100vh);position: absolute;z-index: 10000;">
			<image src="../../../static/icon/loading.png" style="width: 110rpx;height: 110rpx;" class="loading" mode=""></image>
		</view>
		<view @click="close1()" v-if="isShow" style="width: 100%;height: calc(100vh);position: absolute;z-index: 998;"></view>
		<view class="TC" style="z-index: 999;position: relative;" v-if="isShow">
			<view class="box">

				<view class="box1">
					<view class="box1-a">
						<view v-if="code!='0000'" style="font-size: 40rpx;
		color: #a485ed;">
							提示
						</view>
						<view v-if="code!='0000'" style="font-size: 40rpx;
		color: #a485ed;">
							{{msg}}
							<!-- 图片代替 -->
							<!-- <image 
								src="../../../static/icon/视频.jpg" alt=""> -->
							<!-- 视频 -->

						</view>
						<view v-else style="font-size: 40rpx;
						text-align: center;
						color: #a485ed;">
					
							{{cool.name}}
							<view style="font-size: 30rpx;
						color: rgb(204, 204, 204);">{{cool.remark}}</view>
							<image :src="imgURL+cool.picture" alt="">


						</view>

						<view class="btnA">
							<button type="button" style="color: #FFFFFF; " @click="close1()">确认</button>
						</view>
					</view>

				</view>
			</view>
		</view>

		<view class="mack-a" :style=" 'filter: blur('+this.$store.state.mackNum1+'px);'">
			<view style="height: calc(100vh);background-color: #fff;">
				<Back></Back>
				<view style="color: rgb(148,113,254);
			text-align: center;
			font-size: 36rpx;
			margin-top: -52rpx;">我 的</view>
				<view class="duihuan">
					<view>兑换Cool贝卡 </view>
				</view>
				<view style="display: flex;flex-direction: column;align-items: center;">
	<!-- 				<view class="ye" style="width: 348rpx;margin-top: -64rpx;
    margin-bottom: 40rpx;">
						<view style="display: flex;align-items: center;">
							<image style="width: 26rpx;height: 26rpx;" src="../../../static/icon/icon1221/04.png"
								mode=""></image>
							<view>余额：</view>
						</view>
						<view style="margin-left: 52rpx;">{{coo_shell}}</view>
					</view> -->
					<view class="ye">
						<view style="display: flex;align-items: center;">
							<image style="width: 30rpx;height: 27rpx;" src="../../../static/icon/icon1221/05.png"
								mode=""></image>
							<view>兑换数量：</view>
						</view>
						<input value="1" disabled placeholder="单行输入" type="text" style="text-indent: 48rpx; width: 264rpx;
								height: 84rpx;
								margin-left: 22rpx;
								border-radius: 10rpx;
								font-size: 28rpx;
								box-shadow: inset 0px 2px 5px #9e9e9e80;" />
					</view>
					<view style="color: #9471fe;
    font-size: 32rpx;margin-top: 20rpx;">通关所有游戏获得一次兑换cool贝卡机会</view>
					<button class="btn" @click="dhCool()">确认兑换</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,mapState
	} from 'vuex'
	import uniRequest from '@/until/uni-request.js'
	import Back from '../../../components/BackPage.vue'
	export default {
		computed: {//加载数据过程loading
			    ...mapState(["isLoading"])
			},
		components: {
			Back
		},

		onShow() {
			this.getUser()
			this.close1()
		},
		
		data() {
			return {
				imgURL: 'http://113.31.109.223:8000/file/file/download?fileId=',
				cool: '',
				code: '',
				isShow: false,
				msg: '',
				coo_shell: ''
			}
		},
		
		methods: {
			...mapMutations(['openTCdeng', 'closemackNum','closeTCdeng']),
			close1() {
				this.isShow = false
				this.closeTCdeng()
			},
			dhCool() {
				uniRequest.post('nft/nft/exchange', {}).then((res) => {
					console.log(res);
					this.code = res.data.code
					this.cool = res.data.data
					this.msg = res.data.msg
					this.isShow = true
					this.getUser()
					this.openTCdeng()
				}).catch((err) => {
					console.log(err);
				});
			},
			getUser() {
				uniRequest.post('user/user/query').then((res) => {
					console.log(res);
					this.coo_shell = res.data.data.cool_shell
				}).catch((err) => {
					console.log(err);
				});
			}
		}


	}
</script>

<style lang="scss" scoped>
	@keyframes tdtc{
		0% {
				transform: scale(0.8); 
				// transform: scale(0.8);  
				opacity: 0.5;  
			}
		// 50% {
		// 	transform: scale(1);  
		// 	// opacity: 0.5;  
		// }
		45%{
			transform: scale(1);
			opacity: 1; 
		}
			// 90% {
			// 	transform: scale(1);
			// 	opacity: 1; 
			// }
			100% {
				transform: scale(1);
				opacity: 1; 
			}
		}
		.TC {
			animation-name:tdtc;
			animation-duration:0.9s;
			transform-origin:350rpx 500rpx;
			animation-timing-function:cubic-bezier(0.01, 1.24, 0.08, 1.36);
			animation-iteration-count:1;
			animation-play-state: running;
		.toptext {
			position: absolute;
			// top: -8%;
			top: 100rpx;
			left: 35%;
			z-index: 999;
			background-color: #fff;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.text-a {

				font-size: 46rpx;
			}

			.text-b {
				color: rgb(148, 113, 254);
				font-size: 32rpx;
			}
		}

		height: 100%;
		background-color: rgb(255, 255, 255);

		// background: linear-gradient(#7a52c0, #d7d7d7) no-repeat;
		.title {
			text-align: center;
			line-height: 100rpx;
			font-size: 60rpx;
			color: rgb(164, 133, 237);
		}

		.box {
			z-index: 99;
			background-color: #fff;

			.box1 {

				// margin-top: 20rpx;
				.box1-a {
					width: 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					height: 300px;
					align-items: center;

					image {
					    margin-top: 40rpx;
					    width: 200rpx;
					    height: 200rpx;
					
					}
				}
			}

			.send {
				position: absolute;
				right: 52rpx;

				uni-button {
					border-radius: 100rpx;
					height: 92rpx;
					line-height: 92rpx;
					color: #fff;
					width: 144rpx;
					background: rgb(121, 72, 234);
					font-size: 28rpx;
				}
			}

			.box2-a {
				width: 94%;
				height: 16px;
				background-color: #fffefe7d;
				box-shadow: 0px 5px 50px #9e9e9e3b;
				border-radius: 0rem 0rem 10px 10px;
				/* opacity: 0.4; */
				position: absolute;
				left: 3%;
				bottom: -16px;
				// /* z-index: -1;
			}

			.u-input--border[data-v-fdbb9fe6] {
				border-radius: 100rpx;
				height: 96rpx;
				box-sizing: border-box;
				padding-top: 8rpx !important;
				margin-left: 10rpx;
			}

			.username {
				font-size: 18px;
				display: flex;
				align-items: center;

				image {
					width: 16px;
					height: 16px;
					margin-right: 4px;
				}
			}

			.password {
				font-size: 18px;
				display: flex;
				align-items: center;
				margin-top: 30px;

				image {
					width: 16px;
					margin-right: 4px;
					height: 16px;
				}
			}

			.sms {
				display: flex;
				justify-content: end;
				color: rgb(164, 133, 237);
				padding: 10% 0;
				padding-bottom: 12%;
				margin-right: 36rpx;
			}

			z-index: 99;
			background-color: #fff;
			box-sizing: border-box;
			padding: 48rpx;
			box-shadow: 0px 10rpx 100rpx #9e9e9e80;
			position: absolute;
			background: #fff;
			width: 80%;
			height: 764rpx;
			border-radius: 2%;
			top: 228rpx;
			left: 10%;

			.btnA {

				width: 67%;
				margin: 0px auto;
				// margin-top: 40%;

				uni-button {
					border-radius: 64rpx;
					background: linear-gradient(to right, #A272FC, #DE62D2);
				}
			}

			.btnB {
				width: 60%;

				uni-button {
					margin-top: 20rpx;
					border-radius: 32px;
					color: #7a52c0;
				}

				margin: 0px auto;
			}
		}
	}



	.btn {
		width: 80%;
		border-radius: 68rpx;
		font-size: 30rpx;
		height: 100rpx;
		line-height: 100rpx;
		color: #fff;
		background: linear-gradient(to right, #A272FC, #DE62D2);
		margin-top: 20rpx;
	}

	.duihuan {
		margin-top: -54rpx;
		text-align: center;
		color: rgb(148, 113, 254);
		font-size: 56rpx;
		padding-top: 112rpx;
		width: 100%;
		height: 854rpx;
		background-image: url('@/static/icon/icon2/dhCool.png');
		background-position: 62%;
		background-size: 77% 75%;
		background-repeat: no-repeat;

	}

	.ye {
		display: flex;
		align-items: center;
		color: rgb(148, 113, 254);

		image {
			margin-right: 8rpx;
		}
	}
</style>
